Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MMB-118] Previous location not set to null for first update #86

Merged

Conversation

dpiatek
Copy link
Contributor

@dpiatek dpiatek commented Jul 11, 2023

Fix initial location being set too eagerly

This fixes a bug where both previousLocation and currentLocation would be set when .set was called initially.

When setting location, we'd get a handle on the member and update their location. However, because we called .update on the presence, the subscription on the space would trigger as well, get the location and update the member before we emit the location event.

@dpiatek dpiatek requested a review from artismarti July 11, 2023 13:17
@dpiatek dpiatek force-pushed the mmb-118-previousLocation-not-set-to-null-for-first-update branch from 1966db5 to 856fa88 Compare July 11, 2023 15:49
Dominik Piatek added 3 commits July 11, 2023 17:05
This fixes a bug where both previousLocation and currentLocation would be set when .set was called initally.

When setting location, we'd get a handle on the member and update their location. However, because we called .update on the presence, the subscription on the space would trigger as well, get the location and update the member before we emit the location event.
@dpiatek dpiatek force-pushed the mmb-118-previousLocation-not-set-to-null-for-first-update branch from 856fa88 to 0c23203 Compare July 11, 2023 16:05
Copy link
Contributor

@artismarti artismarti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test needs to import the type:

src/LocationTracker.mockClient.test.ts(5,21): error TS2614: Module '"./Locations.js"' has no exported member 'LocationChange'. Did you mean to use 'import LocationChange from "./Locations.js"' instead?

but other than that, looks good.

@dpiatek dpiatek merged commit f35c50b into main Jul 12, 2023
5 checks passed
@dpiatek dpiatek deleted the mmb-118-previousLocation-not-set-to-null-for-first-update branch July 12, 2023 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants